package Time;

import java.util.Timer;
import java.util.TimerTask;

public class Test {
    public static void main(String[] args) throws InterruptedException {
        Timer timer = new Timer();
        timer.schedule(new TimerTask() {
            @Override
            public void run() {
                System.out.println("1000ms");
            }
        }, 1000);
        timer.schedule(new TimerTask() {
            @Override
            public void run() {
                System.out.println("2000ms");
            }
        }, 2000);
        timer.schedule(new TimerTask() {
            @Override
            public void run() {
                System.out.println("3000ms");
            }
        }, 3000);
        //Thread.sleep(4000);
        timer.cancel();
    }
}
